﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPrincipal.master" AutoEventWireup="true" CodeFile="CadastrarMinicursoAE.aspx.cs" Inherits="Minicurso_CadastrarMinicurso" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script src="../scripts/json2.js" type="text/javascript"></script>
    <script src="../scripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
    <link href="../Css/geral.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function SomenteNumero(e) {
            var tecla = (window.event) ? event.keyCode : e.which;
            if ((tecla > 47 && tecla < 58)) return true;
            else {
                if (tecla == 8 || tecla == 0) return true;
                else return false;
            }
        }
        function cadastrar() {
            tinyMCE.triggerSave(true, true);
            $.ajax({
                type: "POST",
                url: "CadastrarMinicursoAG.aspx/cadastrar",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: JSON.stringify({ titulo: $('#TextBoxTitulo').val(), descricao: tinyMCE.get('TextAreaDescricao').getContent(), vagas: $('#TextBoxVagas').val(), local: $('#TextBoxLocal').val() }),
                success:
		            function (msg) {
		                window.location = "GerenciarMinicursoAE.aspx";
		            }
            });
        };
        function voltar() {
            window.location = "GerenciarMinicursoAE.aspx";
        };
        tinyMCE.execCommand("mceAddControl", true, "TextAreaDescricao");
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderConteudo" runat="Server">
    <asp:Label runat="server" ID="LabelCadastrarMinicurso" Font-Bold="true" Text="Cadastrar Minicurso"
        Font-Size="30px"></asp:Label>
    <br />
    <br />
    <table>
        <tr>
            <td style="text-align: right">
                <asp:Label ID="LabelTitulo" runat="server" Text="Título:"></asp:Label>
            </td>
            <td>
                <input type="text" id="TextBoxTitulo" />
            </td>
        </tr>
        <tr>
            <td style="text-align: right">
                <asp:Label ID="LabelDescricao" runat="server" Text="Descricão:"></asp:Label>
            </td>
            <td>
                <textarea id="TextAreaDescricao"></textarea>
            </td>
        </tr>
        <tr>
            <td style="text-align: right">
                <asp:Label ID="LabelVagas" runat="server" Text="Vagas:"></asp:Label>
            </td>
            <td>
                <input onkeypress='return SomenteNumero(event)' type="text" id="TextBoxVagas" style="width: 26px" />
            </td>
        </tr>
        <tr>
            <td style="text-align: right">
                <asp:Label ID="LabelLocal" runat="server" Text="Local:"></asp:Label>
            </td>
            <td>
                <input type="text" id="TextBoxLocal" />
            </td>
        </tr>
    </table>
    <br />
    <br />
    <a href="javascript:voltar()" id="voltar" class="buttonAcao">&laquo; Voltar</a>
    <a id="cadastrar" class="buttonAcao" href="javascript:cadastrar()">Cadastrar</a>
    <div id="dialog-ok" style="display: none">
        Cadastrado com sucesso !
    </div>
</asp:Content>
